﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Ershou.BLL;

public partial class zhmm : System.Web.UI.Page
{
    yh customerSrv = new yh();
    protected void Page_Load(object sender, EventArgs e)
    {

    }

    protected void Button1_Click(object sender, EventArgs e)
    {
        if (Page.IsValid)
        {
            if (!customerSrv.IsNameExist(TextBox1.Text.Trim()))
            {
                Label4.Text = "用户名不存在！";
            }
            else
            {
                if (!customerSrv.IsEmailExist(TextBox1.Text.Trim(), TextBox2.Text.Trim()))
                {
                    Label4.Text = "邮箱不正确！";
                }
                else
                {
                    customerSrv.ResetPassword(TextBox1.Text.Trim(), TextBox2.Text.Trim());
                    EmailSender emailSender = new EmailSender(TextBox2.Text.Trim(), TextBox1.Text.Trim());
                    emailSender.Send();
                    Label4.Text = "密码已发送至邮箱！";
                }
            }
        }
    }
}